<template>
	<view class="itsMe">
		<view class="bg">
			<image src="https://aihelp.oss-cn-hangzhou.aliyuncs.com/kwkd/resources/personal/defaultBg.jpg" mode=""></image>
		</view>
		<view class="homeMain">
			<view class="info font14">
				<!-- 个人信息 -->
				<view class="flex alignCenter">
					<view class="avater">
						<image class="" :src="userInfo.avatar || 'https://image.alhelp.net/uploads/20231104/4d491857ac50d21ebbcb25ff5bc254f8.png'" mode="widthFix"></image>
					</view>
					<view class="lookPersonInfo">
						<view class="font16 nickName bold">{{userInfo.nickName || '匿名用户'}}</view>
						<view class="font14 color999 infoBox hiddenTwoline">{{userInfo.introduction}}</view>
					</view>
				</view>
				<view class="intro">
					<view class="wechat">
						<view class="flex alignCenter">
							<view class="bold">微信号：</view>
							<input class="font14" v-model.trim="wechatNum" type="text" placeholder="请输入微信号">
						</view>
					</view>
					<view class="edu">
						<view class="bold flex alignCenter">
							<text>教育信息</text> 
							<image src="@/static/image/toolbox/edit.png"></image>
						</view>
						<view class="" v-for="(item,index) in eduList" :key="index">
							<view class="colorBlue">{{item.schoolName}}-{{item.majorName}} {{item.graduationYear}}级-{{item.diploma==1?'本科':(item.diploma==2?'硕士研究生':'博士研究生')}}</view>
						</view>
					</view>
					<view class="job">
						<view class="bold">
							<text>职业信息</text>
							<image src="@/static/image/toolbox/edit.png"></image>
						</view>
						<view class="">
							<view class="colorBlue">xx公司-职位  2021年</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="fixedBottomBtn" @click="sureClick">
			<i class="iconfont icon-fabu"></i>确认揭榜
		</view>
	</view>
</template>

<script>
	import { getUserInfo,educationList } from "@/api/mine.js"
	export default {
		data() {
			return {
				userInfo:'',
				isMine:true,
				userId:'',
				eduList:[],
				jobList:[],
				wechatNum:''
			};
		},
		onLoad(option) {
			this.userId=option.userId?option.userId:uni.getStorageSync('userId')
			this.getUser()
			this.getEduList()
		},
		methods:{
			// 获取用户信息
			getUser(){
				getUserInfo({userId:this.userId}).then((res)=>{
					if(res.code==100000){
						this.userInfo=res.data
						this.isMine=uni.getStorageSync('userId')==this.userInfo.userId
					}
				})
			},
			getEduList(){
				let param={
					page:1,
					size:10,
					createUserId:this.userId
				}
				educationList(param).then((res)=>{
					if(res.code==100000){
						this.eduList=res.data.rows
					}
				})
			},
			sureClick(){
				if(!this.wechatNum){
					uni.showToast({
						title:'请输入微信号',
						icon:'none'
					})
					return
				}
				if(this.eduList.length==0){
					uni.showToast({
						title:'请完善教育信息',
						icon:'none'
					})
					return
				}
				if(this.jobList.length==0){
					uni.showToast({
						title:'请完善职业信息',
						icon:'none'
					})
					return
				}
				
			},
			itsMeClick(){
				uni.navigateTo({
					url:'/pages/send/lookFor/itsMe/itsMe'
				})
			}
		},
	}
</script>
<style lang="scss" scoped>
// 自定义导航栏
::v-deep .uni-navbar{
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 100;
}
::v-deep .uni-navbar__content{
	background-color: transparent !important;
	border:none;
}
::v-deep .uni-navbar__header{
	background-color: transparent !important;
}
.homePage{
	padding: 0 0 120rpx;
	box-sizing: border-box;
}
.bg{
	height: 320rpx;
	overflow: hidden;
	image{
		width: 100%;
		height: 100%;
	}
}
.homeMain{
	padding: 0 0 30rpx;
	box-sizing: border-box;
	background:#fff;
	position: relative;
	margin:-110rpx 0 0;
	border-radius: 50rpx 50rpx;
	z-index: 2;
	
	.info{
		padding: 0 30rpx 0;
		margin:0 0 60rpx;
		.avater{
			width: 180rpx;
			height: 180rpx;
			border-radius: 50%;
			margin:-60rpx 20rpx 0 0;
			flex-shrink: 0;
			box-sizing: border-box;
			box-shadow: 0 1px 15rpx rgba(0,0,0,.3);
			image{
				width: 100%;
				height: 100%;
				border-radius: 50%;
			}
		}
		.lookPersonInfo{
			width:100%;
		}
		.nickName{
			padding:10rpx 0 0;
			image{
				width: 48rpx;
				height: 48rpx;
			}
		}
		.infoBox{
			margin: 10rpx 0 0;
			image{
				width: 36rpx;
				height: 36rpx;
			}
		}
		.intro{
			margin:40rpx 0;
			.wechat,
			.edu,
			.job{
				margin:0 0 30rpx;
				image{
					width: 40rpx;
					height: 40rpx;
					margin-left: 20rpx;
				}
			}
			.wechat{
				input{
					height: 80rpx;
					line-height: 80rpx;
					border-bottom: 1px solid $bordercolor;
					flex:1;
				}
			}
		}
	}
	.tabModule{
		padding: 0 30rpx 0;
		box-sizing: border-box;
		margin: 0 0 30rpx;
	}
	.lookAboutModule{
		.shareOne{
			background:#fff;
			padding: 30rpx;
			box-sizing: border-box;
			border-bottom: 20rpx solid $pageBgColor;
			.avatar{
				width:112rpx;
				height:112rpx;
				flex-shrink: 0;
				margin-right: 20rpx;
				position: relative;
				image{
					border-radius: 50%;
					width:100%;
					height:100%;
				}
			}
		}
		.shareOne:last-child{
			border: none;
		}
		.shareInfo{
			width:100%;
		}
	}
}
</style>
